

package game.com;

import java.util.HashMap;

import android.media.MediaPlayer;
import android.content.Context;
import android.util.Log;



// Wrapper for native library

public class GL2JNILib {

     

    /**
     * @param width the current view width
     * @param height the current view height
     */
	private HashMap<Integer, MediaPlayer> players;	
	 
	 
	public void initSound(Context context) {		
		players = new HashMap<Integer, MediaPlayer>();
		//players.put(0, MediaPlayer.create(context, R.raw.title_logo));	
		players.put(1, MediaPlayer.create(context, R.raw.title_menu));		
		// players.put(2, MediaPlayer.create(context, R.raw.title_about));	
		// players.put(3, MediaPlayer.create(context, R.raw.title_level_1));
		// players.put(4, MediaPlayer.create(context, R.raw.title_level_2));			
		// players.put(5, MediaPlayer.create(context, R.raw.title_level_3));		
		// players.put(6, MediaPlayer.create(context, R.raw.title_level_4));	
		// players.put(7, MediaPlayer.create(context, R.raw.title_level_5));
		// players.put(8, MediaPlayer.create(context, R.raw.sfx_bomb_fire));
		// players.put(9, MediaPlayer.create(context, R.raw.sfx_boss_death));
		// players.put(10, MediaPlayer.create(context, R.raw.sfx_box));
		// players.put(11, MediaPlayer.create(context, R.raw.sfx_eat_item));
		// players.put(12, MediaPlayer.create(context, R.raw.sfx_menu_confirm));
		// players.put(13, MediaPlayer.create(context, R.raw.sfx_menu_in_game_confirm));
		// players.put(14, MediaPlayer.create(context, R.raw.sfx_menu_pause));
		// players.put(15, MediaPlayer.create(context, R.raw.sfx_menu_resume));
		// players.put(16, MediaPlayer.create(context, R.raw.sfx_menu_select));
		// players.put(17, MediaPlayer.create(context, R.raw.sfx_monster_death));
		// players.put(18, MediaPlayer.create(context, R.raw.sfx_run));	
		// players.put(19, MediaPlayer.create(context, R.raw.sfx_menu_back));
		// players.put(20, MediaPlayer.create(context, R.raw.sfx_locked));
		
	}

	//
	public void playSound(int sound, int loop) {
		players.get(sound).setLooping(loop == 0);
		players.get(sound).start();
	}

		
	public void stopSound(int id) {		
		players.get(id).pause();		
	}
	
	public void stopAllSound() {
		for (int i = 0; i < 21; i++)
		{
			stopSound(i);
		}
	}
	
	 
	public static native void init(GL2JNILib view);
	public static native void draw();
	public static native void pause();
	public static native void resume();
	public static native void pointerEvent(int state, int x, int y);
	//public static native void keyEvent(int type, int keyCode);
	//public static native void frameRotation(int Rotation);
	
	static 
	{
         System.loadLibrary("vietgameplay");
    }
}
